package com.neusoft.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neusoft.mapper.base.AdminsMapper;
import com.neusoft.model.entity.Admins;
import com.neusoft.model.entity.AdminsExample;
import com.neusoft.model.entity.AdminsExample.Criteria;
import com.neusoft.service.AdminService;

@Service
public class AdminServicImpl implements AdminService{

	
	@Autowired
	AdminsMapper adminsMapper;
	@Override
	public List<Admins> findAdminByID(String id) {
		AdminsExample adminsExample=new AdminsExample();
		Criteria criteria=adminsExample.createCriteria();
		criteria.andIdEqualTo(id);
		List<Admins> admins=new ArrayList<Admins>();
		admins=adminsMapper.selectByExample(adminsExample);	
		return admins;
	}
	@Override
	public List<Admins> findAdminByIDAndPwd(String id, String pwd) {
		AdminsExample adminsExample=new AdminsExample();
		Criteria criteria=adminsExample.createCriteria();
		criteria.andIdEqualTo(id);
		criteria.andPasswordEqualTo(pwd);
		List<Admins> admins=new ArrayList<Admins>();
		admins=adminsMapper.selectByExample(adminsExample);	
		return admins;
		
	}
	@Override
	public boolean testAdmins(String id, String pwd) {
		if(findAdminByIDAndPwd(id, pwd).size()!=0){
			return true;
		}
		return false;
	}

}
